<%--
  Created by IntelliJ IDEA.
  User: Miao's T480s
  Date: 2019/11/15
  Time: 16:46
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>

<html>
<head>
    <title>首页</title>
</head>
<body>
<%--<form action="buyBooks">--%>
<%--   购买账户 <input type="text" name="uid"><br/>--%>
<%--    图书ID<input type="text" name="bid"><br/>--%>
<%--    购买数量<input type="text" name="bnum"><br/>--%>

<%--    <span shiro:hasAnyRoles="admin">--%>
<%--        <input type="submit" value="提交"><br/>--%>
<%--    </span>--%>

<%--</form>--%>

<p id="username"><shiro:principal></shiro:principal>&nbsp;欢迎您！</p>

<form action="buyBooks">
    <table>
        <thead>
        <tr>
            <th>ID</th>
            <th>书名</th>
            <th>库存量</th>
            <th>单价（￥）</th>
            <th>作者</th>
            <th>出版社</th>
            <th>简介</th>
            <shiro:hasRole name="admin">
                <th>操作</th>
            </shiro:hasRole>

        </tr>
        </thead>

        <tbody>
        <c:forEach items="${books}" var="b">

        <tr>
            <td>${b.bid}</td>
            <td>${b.bname}</td>
            <td>${b.bnum}</td>
            <td>${b.price}</td>
            <td>${b.author}</td>
            <td>${b.publisher}</td>
            <td>${b.abstract1}</td>
            <shiro:hasRole name="admin">
                <td><a href="buyBooks?bid=${b.bid}">购买</a></td>
            </shiro:hasRole>

        </tr>

        </c:forEach>
        </tbody>



    </table>
</form>




</body>
</html>
